export default {
    bind(el, binding) {
        const target = el instanceof HTMLInputElement? el: el.querySelector("input")
        target.addEventListener("keyup", e => {
            let value = e.target.value
            if(value) {
                if(value.indexOf('.')>0){
                    e.target.value = value.slice(0,value.indexOf('.')+ parseInt(binding.value) + 1)
                    e.target.dispatchEvent(new Event("input"))
                }
            }
        })
    }
}

